home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
drag&d2a
/
drag.frm
Wrap
Text File
|
1999-09-10
|
5KB
|
161 lines
VERSION 2.00
Begin Form frmDrag
Caption = "Drag & Use"
ClientHeight = 3015
ClientLeft = 1890
ClientTop = 3255
ClientWidth = 6435
Height = 3705
Left = 1830
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3015
ScaleWidth = 6435
Top = 2625
Width = 6555
Begin CommandButton Command1
Caption = "Exit"
Height = 375
Left = 5760
TabIndex = 3
Top = 2640
Width = 735
End
Begin DriveListBox Drive1
Height = 315
Left = 240
TabIndex = 2
Top = 120
Width = 1935
End
Begin FileListBox File1
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 1950
Left = 2400
Pattern = "*.txt;*.bmp;*.exe;*.hlp"
TabIndex = 1
Top = 120
Width = 2055
End
Begin DirListBox Dir1
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 1380
Left = 240
TabIndex = 0
Top = 600
Width = 1935
End
Begin Image Image2
Height = 495
Left = 2040
Top = 2160
Width = 2550
End
Begin Image Image1
BorderStyle = 1 'Fixed Single
Height = 1935
Left = 4680
Stretch = -1 'True
Top = 120
Width = 1725
End
Begin Menu mnufile
Caption = "&File"
Begin Menu mnuback
Caption = "Back to EasyWin"
End
End
End
Sub Command1_Click ()
End
End Sub
Sub Dir1_Change ()
file1.Path = Dir1.Path
End Sub
Sub Drive1_Change ()
Dir1.Path = Drive1.Drive
End Sub
Sub File1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
file1.DragIcon = Drive1.DragIcon
file1.Drag
End Sub
Sub Form_Load ()
frmdrag.Width = 6525
frmdrag.Height = 3500
End Sub
Sub Image1_DragDrop (Source As Control, X As Single, Y As Single)
' Get last three letters of the dragged filename
temp = Right$(file1.FileName, 3)
' If dragged file is in the root, append filename.
If Mid(file1.Path, Len(file1.Path)) = "\" Then
dropfile = file1.Path & file1.FileName
' If dragged file is not in root, append "\" and filename.
Else
dropfile = file1.Path & "\" & file1.FileName
End If
image1.Picture = LoadPicture("")
Select Case temp
Case "txt"
X = Shell("Notepad " + dropfile, 1)
Case "bmp", "wmf", "rle", "ico"
image1.Picture = LoadPicture(dropfile)
Case "exe"
X = Shell(dropfile, 1)
Case "hlp"
X = Shell("WinHelp " + dropfile, 1)
Case "wri"
X = Shell("write " + dropfile, 1)
'add your own case example
'case "mak"
' x = shell("c:\vb\vb.exe + dropfile, 1)
Case Else
nl = Chr$(10) + Chr$(13)
msg = "Try one of these file types:"
msg = nl + msg + nl + nl + " .txt, .bmp, .exe, .hlp"
MsgBox msg
End Select
End Sub
Sub Image1_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
Select Case State
Case 0
' Display a new icon when the source
' enters the drop area.
file1.DragIcon = Dir1.DragIcon
Case 1
' Display the original DragIcon when the source
' leaves the drop area.
file1.DragIcon = Drive1.DragIcon
End Select
' Note that Dir1.DragIcon and Drive1.DragIcon have been
' set at design time. This allows you to load the "Enter
' and "Leave" icons for File1 at runtime without requiring
' that the user has those icons are on disc.
End Sub
Sub mnuback_Click ()
End
End Sub